import type { App } from 'vue';
import { createPinia } from 'pinia';
import { registerPiniaPersistPlugin } from '@/store/plugin/persist';
import { createSyncPlugin } from '@/store/plugin/sync';

const store = createPinia();
registerPiniaPersistPlugin(store);
store.use(createSyncPlugin()); // 增加跨浏览器页面通讯插件。

export function setupStore(app: App<Element>) {
  app.use(store);
}

export { store };
